package dev.xesam.androidkit.utils;

import android.content.Context;
import android.text.ClipboardManager;

public class ClipboardUtil {

    @SuppressWarnings("deprecation")
    public static String getClipboard(Context context) {
        android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        return clipboard.getText().toString();
    }

    @SuppressWarnings("deprecation")
    public static void setClipboard(Context context, String text) {
        ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
        clipboard.setText(text);
    }
}
